package init;

import java.sql.*;

public class DBQuery {

    private DBConnectionMgr pool = null;

    public DBQuery() {
        try{
            pool = DBConnectionMgr.getInstance();
        }catch(Exception e){
            System.out.println("fail : DBQuery");
        }
    }
    
    public ResultSet executeQuery(String strQuery)
    { 
    	   	
    	Connection con = null;
	    PreparedStatement pstmt = null;
	    ResultSet rs = null;	    
	    
	    try {
	        con = pool.getConnection();
			pstmt = con.prepareStatement(strQuery);
            rs = pstmt.executeQuery();
	    }catch(Exception ex) {
            System.out.println("Exception:" + ex);       
	    }finally{
	         pool.freeConnection(con,pstmt,rs);
	    }
	    return rs;
	}
}
